Home:ALL Converter>Force Script to run in Python 3

Force Script to run in Python 3

Ask Time:2015-03-31T02:57:16         Author:cclloyd

Json Formatter

I have a script that I wrote in Python 3, and while experimenting with GUIs, I found one I seemed to like called Kivy. Everyone is saying it works with Python 3, but whenever I run it, it runs in Python 2.7. How can I either

A: Get Kivy to run in Python 3 completely

or

B: Force the script that part of my Kivy app calls to run in Python 3.

I'm on OS X 10.10 with both python 3 and 2 installed.

I just tried

myModule.py:

#!/usr/bin/env python3

import sys
def getVersion():
    return sys.version_info

Where I run kivy myapp.py that all it does it print a label with getVersion() as the content of that label. But that still seems to show 2.7.

Author:cclloyd,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/29354038/force-script-to-run-in-python-3
miradulo :

She-bang the Python version that you want your GUI to run, using something like\n\n#!/usr/bin/env python3\n\n\nat the top of the .py file. \nAlternatively, you can set up your virtualenv to run Python 3 with the command-line argument:\n\nvirtualenv -p /usr/bin/python3.4\n",
2015-03-30T19:15:14
yy